<?php 

namespace app\admin\controller;

class Paymethod extends Base
{

    public function index(){
        $tenant = model('Tenant');
        $facePayment = $tenant->where('id', session("TENANT_ID"))->field('isFacePayment')->find();

        $this->assign('face_payment', $facePayment);

        return $this->fetch();
    }

    public function setFacePayment(){
        if($this->request->isAjax()){
            $isFacePayment = $this->request->param('isFacePayment');
            $tenant = model('Tenant');
            $result = $tenant->where('id', session("TENANT_ID"))->update(['isFacePayment' => $isFacePayment]);

            if($result !== false){
                return json(['status' => 1], 200);
            }else{
                return json(['status' => 0, 'msg' => '失败！'], 200);
            }
        }
    }

}